home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWViews / FWGrowBx.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.4 KB  |  144 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGrowBx.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFrameW.hpp"
  11.  
  12. #ifndef FWGROWBX_H
  13. #include "FWGrowBx.h"
  14. #endif
  15.  
  16. #ifndef FWFRAME_H
  17. #include "FWFrame.h"
  18. #endif
  19.  
  20. #ifndef FWSCLBAR_H
  21. #include "FWSclBar.h"
  22. #endif
  23.  
  24. #ifndef FWEVENT_H
  25. #include "FWEvent.h"
  26. #endif
  27.  
  28. #ifndef FWCONTXT_H
  29. #include "FWContxt.h"
  30. #endif
  31.  
  32. // ----- OpenDoc Includes -----
  33.  
  34. #ifndef SOM_ODFacet_xh
  35. #include <Facet.xh>
  36. #endif
  37.  
  38. #ifndef SOM_ODWindow_xh
  39. #include <Window.xh>
  40. #endif
  41.  
  42. //========================================================================================
  43. // File scope definitions
  44. //========================================================================================
  45.  
  46. #ifdef FW_BUILD_MAC
  47. #pragma segment fwgadgts
  48. #endif
  49.  
  50. //========================================================================================
  51. // CLASS FW_CGrowBox
  52. //========================================================================================
  53.  
  54. FW_DEFINE_CLASS_M1(FW_CGrowBox, FW_CView)
  55.  
  56. // This class is archivable, but we provide the archiving implementation in a separate
  57. // translation unit in order to enable deadstripping of the archiving-related code
  58. // in parts that do not use archiving with this class.
  59.  
  60. //----------------------------------------------------------------------------------------
  61. // FW_CGrowBox::FW_CGrowBox
  62. //----------------------------------------------------------------------------------------
  63.  
  64. FW_CGrowBox::FW_CGrowBox(Environment* ev, 
  65.                          FW_CSuperView* container, ODID id,
  66.                          const FW_CPoint& location) :
  67.     FW_CView(ev, container, FW_CRect(location, FW_kFixed0,FW_kFixed0), id) 
  68. {
  69.     SetSize(ev, FW_CScrollBar::GetDefaultScrollBarSize());
  70.     SetBindings(ev, FW_kFixedSize + FW_kRightBinding + FW_kBottomBinding);
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // FW_CGrowBox::FW_CGrowBox
  75. //----------------------------------------------------------------------------------------
  76.  
  77. FW_CGrowBox::FW_CGrowBox(Environment* ev) :
  78.     FW_CView(ev) 
  79. {
  80. }
  81.  
  82. //----------------------------------------------------------------------------------------
  83. // FW_CGrowBox::~FW_CGrowBox
  84. //----------------------------------------------------------------------------------------
  85.  
  86. FW_CGrowBox::~FW_CGrowBox()
  87. {
  88. }
  89.  
  90. //----------------------------------------------------------------------------------------
  91. // FW_CGrowBox::Draw
  92. //----------------------------------------------------------------------------------------
  93.  
  94. void FW_CGrowBox::Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape)
  95. {
  96. #ifdef FW_BUILD_MAC
  97.     FW_CAcquiredODWindow aqODWindow = facet->GetFrame(ev)->AcquireWindow(ev);
  98.     ODPlatformWindow window = aqODWindow->GetPlatformWindow(ev);
  99.         
  100.     // Clip to the grow box to avoid drawing the scollbars which may not be there
  101.     FW_CViewContext vc(ev, this, facet, invalidShape);
  102.  
  103.     ::DrawGrowIcon(window);
  104.     
  105. #endif
  106. }
  107.  
  108. //----------------------------------------------------------------------------------------
  109. // FW_CGrowBox::DoActivateEvent
  110. //----------------------------------------------------------------------------------------
  111.  
  112. void FW_CGrowBox::DoActivateEvent(Environment *ev, const FW_CActivateEvent& theActivateEvent)
  113. {
  114. #ifdef FW_BUILD_MAC
  115.     ODFacet* facet = theActivateEvent.GetFacet(ev);
  116.     
  117.     // we simply draw the grow box again (DrawGrowIcon takes care of the activate state)
  118.     Draw(ev, facet, NULL);    
  119. #endif
  120. }
  121.  
  122. //----------------------------------------------------------------------------------------
  123. //    FW_CGrowBox::Flatten
  124. //----------------------------------------------------------------------------------------
  125.  
  126. void FW_CGrowBox::Flatten(Environment* ev, FW_CWritableStream& stream) const
  127. {
  128.     FW_CView::Flatten(ev, stream);
  129. }
  130.  
  131. //----------------------------------------------------------------------------------------
  132. //    FW_CGrowBox::InitializeFromStream
  133. //----------------------------------------------------------------------------------------
  134.  
  135. void FW_CGrowBox::InitializeFromStream(Environment* ev, FW_CReadableStream& stream)
  136. {
  137.     FW_CView::InitializeFromStream(ev, stream);
  138.     
  139.     // Enforce standard size and bindings 
  140.     SetSize(ev, FW_CScrollBar::GetDefaultScrollBarSize());
  141.     SetBindings(ev, FW_kFixedSize + FW_kRightBinding + FW_kBottomBinding);
  142. }
  143.  
  144.